#define  _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
int reverse(int x)
{
    int ret = 0;
    while (x != 0)
    {
        if (ret < INT_MIN / 10 || ret > INT_MAX / 10)
        {
            return 0;
        }
        int digit = x % 10;
        x /= 10;
        ret = ret * 10 + digit;
    }
    return ret;
}